{% extends "admin/base.html" %}

{% block content %}
<div class="jumbotron">
	<div class="container">
		<h1>统计</h1>
	</div>
</div>
<div class="container">
	<div class="row d-flex align-items-center">
		<div class="col-md-4 text-right">
			<h5> 用户注册数 <b>{{ user_count }}</b></h5>
			{% if get_config('user_mode') == 'teams' %}
			<h5> 团队注册数 <b>{{ team_count }}</b></h5>
			{% endif %}
			<h5> IP地址数 <b>{{ ip_count }}</b></h5>
			<hr>
			<h5> 挑战总分 <b>{{ total_points }}</b></h5>
			<h5> 挑战数 <b>{{ challenge_count }}</b></h5>
			{% if most_solved %}
				<h5> 攻破最多 <b>{{ most_solved }}</b> <br>{{ solve_data[most_solved] }} 个</h5>
			{% endif %}
			{% if least_solved %}
			<h5> 攻破最少 <b>{{ least_solved }}</b> <br>{{ solve_data[least_solved] }} 个</h5>
			{% endif %}
		</div>

		<div class="col-md-8">
			<div id="solves-graph" class="d-flex align-items-center">
				<div class="text-center w-100">
					<i class="fas fa-circle-notch fa-spin fa-3x fa-fw spinner"></i>
				</div>
			</div>
		</div>
	</div>

	<hr>

	<div class="row">
		<div class="col-md-12">
			<div id="score-distribution-graph" class="d-flex align-items-center">
				<div class="text-center w-100">
					<i class="fas fa-circle-notch fa-spin fa-3x fa-fw spinner"></i>
				</div>
			</div>
		</div>
	</div>

	<hr>

	<div class="row">
		<div class="col-md-12">
			<div id="solve-percentages-graph" class="d-flex align-items-center">
				<div class="text-center w-100">
					<i class="fas fa-circle-notch fa-spin fa-3x fa-fw spinner"></i>
				</div>
			</div>
		</div>
	</div>

	<hr>

	<div class="row">
		<div class="col-md-6">
			<div id="keys-pie-graph" class="d-flex align-items-center">
				<div class="text-center w-100">
					<i class="fas fa-circle-notch fa-spin fa-3x fa-fw spinner"></i>
				</div>
			</div>
			<div class="text-center">
				<h5><b>{{ solve_count }}</b> 个正确提交</h5>
				<h5><b>{{ wrong_count }}</b> 个错误提交</h5>
			</div>
		</div>
		<div class="col-md-6">
			<div id="categories-pie-graph" class="d-flex align-items-center">
				<div class="text-center w-100">
					<i class="fas fa-circle-notch fa-spin fa-3x fa-fw spinner"></i>
				</div>
			</div>
		</div>
	</div>

</div>
{% endblock %}

{% block scripts %}
	<script defer src="{{ url_for('views.themes', theme='admin', path='js/echarts.bundle.js') }}"></script>
	<script defer src="{{ url_for('views.themes', theme='admin', path='js/graphs.js') }}"></script>
{% endblock %}

{% block entrypoint %}
	<script defer src="{{ url_for('views.themes', theme='admin', path='js/pages/statistics.js') }}"></script>
{% endblock %}
